package com.shuqi.activity.viewport;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewParent;
import android.widget.TextView;

/**
 * 防止点击父控件时，自己也响应点击效果的TextView（其他控件同理也可实现解决此类问题）
 *@author yanghuawei
 */
public class PressedTextView extends TextView {

	public PressedTextView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

	public void setPressed(boolean pressed) {
		ViewParent parent = getParent();

		if (pressed && parent != null && parent instanceof View && ((View) parent).isPressed()) {
			return;
		}
		super.setPressed(pressed);

	};

}
